package org.tsinghua.answer.domain.question;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Transient;

import org.tsinghua.answer.domain.entity.BaseEntity;
import org.tsinghua.answer.domain.user.User;

@Entity
public class Question extends BaseEntity {

	@Enumerated(value=EnumType.STRING)
	private QuestionStatus status = QuestionStatus.WAITING;
	@OneToOne
	@JoinColumn(name="creator_id")
	private User creator;
	@Transient
	private String creatorId;
	private String subjectId;
	private String title;
	private String description;
	@OneToMany(mappedBy="question")
	private Set<Reply> replies;
	
	public QuestionStatus getStatus() {
		return status;
	}
	public void setStatus(QuestionStatus status) {
		this.status = status;
	}
	public User getCreator() {
		return creator;
	}
	public void setCreator(User creator) {
		this.creator = creator;
	}
	public String getCreatorId() {
		return creatorId;
	}
	public void setCreatorId(String creatorId) {
		this.creatorId = creatorId;
	}
	public String getSubjectId() {
		return subjectId;
	}
	public void setSubjectId(String subjectId) {
		this.subjectId = subjectId;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Set<Reply> getReplies() {
		return replies;
	}
	public void setReplies(Set<Reply> replies) {
		this.replies = replies;
	}
}
